package com.example.demo.Controller;


import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/res")
@Controller
public class ResponseController {
    @RequestMapping("/index")
    public String index(){
        return "/index.html";
    }

    //设置状态码：
    @ResponseBody
    @RequestMapping("/getStats")
    public String setStats(HttpServletResponse response){
        response.setStatus(4044);
        return "状态码设置成功！";
    }

    @ResponseBody
    @RequestMapping(value = "/setContentType", produces = "application/json")
    public String setContentType(){
        return "{\"OK\":1}";
    }




}
